package com.steven.im.net;

import com.alibaba.fastjson.JSONObject;
import com.steven.im.entity.AdvertEntity;
import com.steven.im.entity.BaseEntity;
import com.steven.im.entity.ImBaseEntity;
import com.steven.im.entity.mobileLoginBo;
import com.steven.im.entity.LoginEntity;

import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * Created by Steven on 2019/1/4.
 */
public interface ApiService {
    //===============首页获取banner、商品、导航栏以及信息栏=====================
    //首页获取banner、商品、导航栏以及信息栏
    @GET("/index")
    Call<BaseEntity> getHomeDetails();

    //商品详情
    @POST("/goods")
    Call<BaseEntity> getGoodDetail(@Query("issuedNo") String issuedNo);

    //获取评论信息
    @POST("/goods/feedback")
    Call<BaseEntity> getFeedBack(@Query("pageNo") String pageNo,
                                 @Query("pageSize") String pageSize,
                                 @Query("goodsId") String goodId);

    //收藏商品
    @POST("/goods/favorite")
    Call<BaseEntity> collectionGood(@Query("token") String token,
                                    @Query("goodsId") String goodsId);

    //获取往期成交
    @POST("/goods/history")
    Call<BaseEntity> getHistory(@Query("pageNo") String pageNo,
                                @Query("pageSize") String pageSize,
                                @Query("goodsId") String goodId);

    //竞拍商品
    @POST("/goods/bidding")
    Call<BaseEntity> bid(@Query("issuedNo") String issuedNo,
                         @Query("count") String count);

    //商品详情刷新
    @POST("/refresh/goods")
    Call<BaseEntity> refresh(@Query("issuedNo") String issuedNo);

    //出价记录
    @POST("/goods/biddingRecodeList")
    Call<BaseEntity> getBidRecord(@Query("issuedNo") String issuedNo,
                                  @Query("pageSize") String pageSize,
                                  @Query("pageNo") String pageNo);

    //前往下一期
    @POST("/goods/nextBidding")
    Call<BaseEntity> nextBid(@Query("issuedNo") String issuedNo);

    //首页刷新
    @POST("/refresh/index")
    Call<BaseEntity> refreshHome(@Query("goodsIds[]") String[] issuedNos);

    //===============发现====================
    //获取发现列表
    @POST("/discovery/IMPhoneContacts")
    Call<BaseEntity> getNewsList(@Query("pageNo") String pageNo,
                                 @Query("pageSize") String pageSize);

    //===============我的地址部分=====================
    //获取我的地址列表
    @POST("/my/address/IMPhoneContacts")
    Call<BaseEntity> getMyAddrList();

    //删除地址
    @POST("/my/address/remove")
    Call<BaseEntity> removeAddr(@Query("addressId") String addressId);


    //获取省份信息
    @POST("/my/address/add/init")
    Call<BaseEntity> addressInit();

    //获取市区信息
    @POST("/my/address/region")
    Call<BaseEntity> getRegion(@Query("parentId") String parentId);

    //确认添加地址
    @FormUrlEncoded
    @POST("/my/address/add/submit")
    Call<BaseEntity> submitAddr(@Field("receiver") String receiver,
                                @Field("mobile") String mobile,
                                @Field("regionId") String regionId,
                                @Field("street") String street,
                                @Field("status") String status);

    //编辑地址
    @FormUrlEncoded
    @POST("/my/address/modify/init")
    Call<BaseEntity> modifyAddrInit(@Field("addressId") String addressId);

    //确认编辑地址
    @FormUrlEncoded
    @POST("/my/address/modify/submit")
    Call<BaseEntity> submitModifyAddr(@Field("addressId") String addressId,
                                      @Field("receiver") String receiver,
                                      @Field("mobile") String mobile,
                                      @Field("regionId") String regionId,
                                      @Field("street") String street,
                                      @Field("status") String status);

    //===============登录注册部分=====================
    //用户信息初始化
    @POST("/account/init")
    Call<BaseEntity> accountInit(@Query("mobile") String mobile);

    //注册
    @POST("/account/sign")
    Call<BaseEntity> accountSign(@Query("mobileCode") String mobileCode,
                                 @Query("mobile") String mobile,
                                 @Query("password") String password, @Query("signCode") String signCode);

    //发送验证码
    @POST("/captcha/sendSms")
    Call<BaseEntity> sendPhoneCode(@Query("mobile") String mobile,
                                   @Query("captcha") String captcha);

    //登录
    @POST("/account/login")
    Call<LoginEntity> accountLogin(
            @Query("token") String token, @Query("mobile") String mobile,
            @Query("password") String password
    );

    //登录检查
    @POST("/account/loginCheck")
    Call<BaseEntity> accountLoginCheck();

    //退出
    @POST("/account/logout")
    Call<String> accountLogout();

    //重置交易密码  mobile   mobileCode password
    @POST("/account/resetPassword")
    Call<BaseEntity> resetPwd(@Query("mobile") String mobile,
                              @Query("mobileCode") String mobileCode,
                              @Query("password") String password);

    //获取token
    @GET("system/token")
    Call<BaseEntity> getToken();

    //===============系统部分=====================
    //系统参数
    @GET("/system/parameters")
    Call<BaseEntity> getSystemParam();


    //===============分类部分=====================
    //获取列表
    @GET("/category/IMPhoneContacts")
    Call<BaseEntity> getCatList();

    //获取商品
    @POST("/category/goods")
    Call<BaseEntity> getCatGoods(@Query("categoryId") String categoryId);

    //===============系统部分=====================
    @GET("/system/advert")
    Call<AdvertEntity> getSystemAdvert();


    //===============我的收藏部分=====================
    //我的收藏
    @POST("/my/favorite/IMPhoneContacts")
    Call<BaseEntity> getMyFavList();

    //取消收藏
    @POST("/my/favorite/cancel")
    Call<BaseEntity> cancelCollection(@Query("favoriteId") String favoriteId);

    //===============我的部分=====================
    //我的账户信息
    @POST("/my/account")
    Call<BaseEntity> getMyAccount();

    //我的个人信息
    @POST("/my/account/reset")
    Call<BaseEntity> getAccountInfo();

    //钱包明细
    @POST("/my/account/details")
    Call<BaseEntity> getMyWallet(@Query("pageNo") int pageNo,
                                 @Query("pageSize") String pageSize,
                                 @Query("type") int type);

    //修改个人信息（昵称）
    @FormUrlEncoded
    @POST("/my/account/reset/submit")
    Call<BaseEntity> editMyInfo(@Field("nickname") String nickname,
                                @Field("avatar") String avatar);


    //===============我的订单部分=====================
    //订单列表
    @POST("/my/order/IMPhoneContacts")
    Call<BaseEntity> getOrderList(@Query("pageNo") String pageNo,
                                  @Query("pageSize") String pageSize,
                                  @Query("status") String type);

    //确认收货
    @POST("/my/order/receipt")
    Call<BaseEntity> orderReceipt(@Query("orderId") String orderId);

    //晒单
    @FormUrlEncoded
    @POST("/my/order/feedback")
    Call<BaseEntity> showOrder(@Field("orderId") String orderId,
                               @Field("content") String content,
                               @Field("imageUrl") String imgUrl);

    //===============订单部分=====================
    //生成普通商品订单
    @POST("/order/init")
    Call<BaseEntity> goodsInit(@Query("issuedNo") String issuedNo,
                               @Query("type") String salesType);

    //生成订单  商品订单
    @POST("/order/init")
    Call<BaseEntity> oredrInit(@Query("orderId") String goodsId,
                               @Query("type") String salesType);

    //确认订单支付界面
    @POST("/order/submit")
    Call<BaseEntity> submitOrder(@Query("orderId") String orderId,
                                 @Query("addressId") String addressId,
                                 @Query("paymentCode") String paymentCode);

    //充值界面
    @GET("/recharge/init")
    Call<BaseEntity> initRecharge();

    //进行充值
    @POST("recharge/submit")
    Call<BaseEntity> rechage(@Query("paymentCode") String paymentCode,
                             @Query("amount") String amount);

    //===============第三方登录部分=====================
    //微信登录
    @POST("/thirdlogin/wechat")
    Call<BaseEntity> wechatCode(@Query("code") String code);

    //绑定手机号
    @POST("/thirdlogin/binding")
    Call<BaseEntity> bindingMobile(@Query("unionId") String unionId,
                                   @Query("mobile") String mobile,
                                   @Query("mobileCode") String mobileCode,
                                   @Query("password") String password,
                                   @Query("signCode") String signCode);

    //系统更新
    @GET("/system/version")
    Call<BaseEntity> checkVersion();
//    ===========================im===========================

    //im 手机登录
    @POST("/sso/loginByMobile")
    Call<ImBaseEntity> imLogin(@Body mobileLoginBo mobileLoginBo);

    //发送验证码
    @POST("/sms/sms/codes")
    Call<ImBaseEntity> sendImPhoneCode(@Query("phone") String phone);

    //上传通讯录
    @POST("/tbUserContacts/InsertUserContacts")
    Call<ImBaseEntity> imPushContact();
}
